package sky.wechat_tools.impl;

import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import sky.wechat_tools.api.MainService;
import sky.wechat_tools.util.WxConfig;
import sky.wechat_tools.util.crypto.SHA1;

public class WxService implements MainService {
    protected CloseableHttpClient httpClient;
    public WxService() {
        httpClient = HttpClients.createDefault();
    }

    @Override
    public boolean checkSignature(String signature, String timestamp, String nonce, String echostr) {
        try {
            return SHA1.gen(WxConfig.getInstance().getToken(), timestamp, nonce).equals(signature);
        } catch (Exception e) {
            return false;
        }
    }

    @Override
    public String getAccessToken(){

        return null;
    }
}
